<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>人力资源信息配置平台</title>
	<link rel="stylesheet" href="__PUBLIC__/Center/css/ch-ui.admin.css">
	<link rel="stylesheet" href="__PUBLIC__/Center/css/login.css">
	<link rel="stylesheet" href="__PUBLIC__/Center/font/css/font-awesome.min.css">
	<link rel="shortcuticon" href="/favicon.ico" />
	<script src="__PUBLIC__/Center/js/jquery.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Center/js/layer.js"></script>
	<script>
		$().ready(function(){
			$('p[name=comment]').hide();
			//切换验证码
			$('img[class=captcha]').bind('click',function(){
				this.src = this.src + '?rand=' + Math.random();
			})
			//检测表单内容合法性
			$('form').bind('submit',function(){
				if($('input[name=username]').val()==''){
					$('p[name=comment]').html('用户名不能为空!');
					$('p[name=comment]').show(100);
					return false;
				}
				if($('input[name=password]').val()==''){
					$('p[name=comment]').html('密码不能为空!');
					$('p[name=comment]').show(100);
					return false;
				}
				if($('input[name=captcha]').val()==''){
					$('p[name=comment]').html('验证码不能为空!');
					$('p[name=comment]').show(100);
					return false;
				}
				//ajax检测验证码
				var captcha = $('input[name=captcha]').val();
				var flag = false;
				$.ajax({
					url:'{:U('ajaxCheckCaptcha')}',
	                data:{'captcha':captcha},
	                cache: false,
	                async:false,
	                type:"POST",
	                dataType:'json',
	                success:function(msg){
	                	if(msg==1){
	                		flag = true;
	                	}
	                }
	            });
	            if(flag){
					return true;
	            }else{
	            	$('p[name=comment]').html('验证码有误!');
					$('p[name=comment]').show(100);
	            	return false;
	            }
			})
		});
	</script>
</head>
<body style="background:#F3F3F4;">
	<div class="login_box" style="overflow:hidden;">
		<h1>
			<img src="__PUBLIC__/Center/img/logo.png" width="15%">
		</h1>
		<h2>欢迎使用人力资源信息配置平台</h2>
		<h3>当前更新版本 <span>v1.03</span></h3>
		<div class="form">
			<p style="color:red" name="comment"></p>
			<form action="" method="post">
				<ul>
					<li>
					<input type="text" name="username" class="text"/>
						<span><i class="fa fa-user"></i></span>
					</li>
					<li>
						<input type="password" name="password" class="text"/>
						<span><i class="fa fa-lock"></i></span>
					</li>
					<li>
						<input type="text" class="code" name="captcha"/>
						<span><i class="fa fa-check-square-o"></i></span>
						<img src="{:U('captcha')}" alt="" class="captcha">
					</li>
					<li>
						<input type="submit" value="立即登陆"/>
					</li>
				</ul>
			</form>
		</div>
	</div>
</body>
</html>